# Contributor: Dmitry Zakharchenko <dmitz@disroot.org>
# Maintainer: Dmitry Zakharchenko <dmitz@disroot.org>
pkgname=youtube-viewer
pkgver=3.10.0
pkgrel=0
pkgdesc="Lightweight YouTube client"
url="https://github.com/trizen/youtube-viewer"
arch="noarch"
license="Artistic-2.0"
makedepends="perl-module-build"
depends="
	perl-data-dump
	perl-json
	perl-libwww
	perl-lwp-protocol-https
	perl-term-readline-gnu
	perl-unicode-linebreak
	"
checkdepends="perl-test-pod"
subpackages="$pkgname-doc $pkgname-gtk"
source="$pkgname-$pkgver.tar.gz::$url/archive/$pkgver.tar.gz"

build() {
	perl Build.PL --gtk3
}

check() {
	./Build test
}

package() {
	./Build install --destdir "$pkgdir" --installdirs vendor
}

gtk() {
	depends="$pkgname perl-gtk3 perl-file-sharedir"
	pkgdesc="$pkgdesc (GTK interface)"

	amove "usr/bin/gtk*-youtube-viewer"
	amove "usr/share/perl5/vendor_perl/auto/share/dist/WWW-YoutubeViewer/gtk*"
	amove usr/share/perl5/vendor_perl/auto/share/dist/WWW-YoutubeViewer/icons
}

sha512sums="
600ff02154e97df2fcada7e9f49759271adda9129cc6e2342822066e6307806bbbb0e0a6683483c3f321f0a334a11fbde99ffde854874e5e8ab379832445b33a  youtube-viewer-3.10.0.tar.gz
"
